<template>
  <div class="w h f-c a-i-c c8">
    页面正在跳转中....
  </div>
</template>

<script lang="ts">
/**
 * 为了处理不通的用户有不通的权限，需要根据用户实际权限进行首次跳转界面
 * 当前页面通过用户权限跳转到默认页面
 */
export default {
  name: 'redirected',
  data() {
    return {}
  },
  computed: {
    userMenuRouteNameList(): string[] {
      return ((this as any).$store.getters['role/roleUserMenuName'] || []).filter(
        (name: string) => {
          return !['main', 'login', 'register', '404'].includes(name.toLocaleLowerCase())
        }
      )
    },
    firstPage(): string {
      if (!this.userMenuRouteNameList || this.userMenuRouteNameList.length > 0) {
        /**
         * 默认不跳转 编辑 和弹出页面
         */
        const userRouterList = this.userMenuRouteNameList.filter((item: string) => (item || '').toLocaleLowerCase().indexOf('create') < 0 && (item || '').toLocaleLowerCase().indexOf('edit') < 0 && !['DataCheck'].includes(item))
        if (userRouterList.length > 0) {
          // return userRouterList[0]
          
        }
      }
      return 'permission'
    }
  },
  mounted() {
    this.$router.push({ name: this.firstPage })
  }
}
</script>

<style lang="scss" scoped></style>